//
//  Const.swift
//  RxSwift.Test
//
//  Created by cijian on 2020/8/10.
//  Copyright © 2020 cijian. All rights reserved.
//

import UIKit
import Foundation

@_exported import RxSwift
@_exported import RxCocoa
@_exported import RxBlocking

extension NSObject {
   
    func getPropertyNames(){
        
        var outCount:UInt32
        outCount = 0
        let propers:UnsafeMutablePointer<objc_property_t>! =  class_copyPropertyList(self.classForCoder, &outCount)
        let count:Int = Int(outCount);
        guard count > 0 else {
            return
        }
        print(outCount)
        for i in 0...(count-1) {
            let aPro: objc_property_t = propers[i]
            if let proName: String = String.init(utf8String: property_getName(aPro)) {
                print(proName)
            }
        }
    }
    
    
    func getMethodNames(){
        
        var outCount:UInt32
        
        outCount = 0
        
        let methods:UnsafeMutablePointer<objc_property_t>! =  class_copyMethodList(self.classForCoder, &outCount)
        
        let count:Int = Int(outCount);
        
        print(outCount)
        
        for i in 0...(count-1) {
            
            let aMet: objc_property_t = methods[i]
            
            if let methodName  = String.init(utf8String: property_getName(aMet)) {
                print(methodName)
            }
        }
        
    }
    
}
